/************/
/* Includes */
/************/
#include <iostream>
using namespace std;
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;

using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Drawing;
public ref class Form1: public Form
{
private:
   Button^ evaluateBtn;
   TextBox^ textBox1;
   TextBox^ textBox2;
   ErrorProvider^ myErrProvider;
   Label^ label1;
   Label^ label2;

public:
   Form1()
   {
		evaluateBtn		= gcnew Button;
		textBox1		= gcnew TextBox;
		textBox2		= gcnew TextBox;
		label1			= gcnew Label;
		label2			= gcnew Label;
		myErrProvider	= gcnew ErrorProvider;
		Controls->Add(evaluateBtn);
		Controls->Add(textBox1);
		Controls->Add(textBox2);
		Controls->Add(label1);
		Controls->Add(label2);
		evaluateBtn->Location	= Point(45,150);
		evaluateBtn->Text = "evaluate";
		evaluateBtn->Click += gcnew EventHandler(this, &Form1::evaluateBtn_Click);
		textBox1->Location	= Point(30,30);
		textBox2->Location	= Point(30,80);
		label1->Location = Point(30,15);
		label1->Text     = "only numbers:";
		label2->Location = Point(30,60);
		label2->Text     = "only characters:";
		myErrProvider->BlinkStyle = ErrorBlinkStyle::NeverBlink;

   }



   
private:
		System::Void evaluateBtn_Click(System::Object^  sender, System::EventArgs^  e) {

				myErrProvider->SetError(textBox1,"");
				myErrProvider->SetError(textBox2,"");

			 }

			bool istextBox1Valid()
			{
				array<Char>^ box1Text = textBox1->Text->ToCharArray();
				for(int i = 0; i < box1Text->Length; i++)
				{
					if((Char::IsNumber(box1Text[i])) == false)
					{
						myErrProvider->SetError(textBox1,"please input numbers only");
						return false;
					}
					else
						continue;
				}
				return true;
			}

			bool istextBox2Valid()
			{
				array<Char>^ box2Text = textBox2->Text->ToCharArray();
				for(int i = 0; i < box2Text->Length; i++)
				{
					if((Char::IsLetter(box2Text[i])) == true)
					{
						myErrProvider->SetError(textBox2,"please input characters only");
						return false;
					}
					else
						continue;
				}
				return true;
			}

};


int main()
{

	Application::Run( gcnew Form1 );

	return 0;
}
